package hello.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2011-10-10 23:53:00")
/** */
public final class UserEntryMeta extends org.slim3.datastore.ModelMeta<hello.model.UserEntry> {

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, java.lang.Long> counter = new org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, java.lang.Long>(this, "counter", "counter", java.lang.Long.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, java.util.Date> created = new org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, java.util.Date>(this, "created", "created", java.util.Date.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<hello.model.UserEntry> destination = new org.slim3.datastore.StringAttributeMeta<hello.model.UserEntry>(this, "destination", "destination");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, java.lang.Boolean> thumbnailLoaded = new org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, java.lang.Boolean>(this, "thumbnailLoaded", "thumbnailLoaded", java.lang.Boolean.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<hello.model.UserEntry> thumbnailUrl = new org.slim3.datastore.StringAttributeMeta<hello.model.UserEntry>(this, "thumbnailUrl", "thumbnailUrl");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<hello.model.UserEntry> title = new org.slim3.datastore.StringAttributeMeta<hello.model.UserEntry>(this, "title", "title");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<hello.model.UserEntry> userId = new org.slim3.datastore.StringAttributeMeta<hello.model.UserEntry>(this, "userId", "userId");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<hello.model.UserEntry, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final UserEntryMeta slim3_singleton = new UserEntryMeta();

    /**
     * @return the singleton
     */
    public static UserEntryMeta get() {
       return slim3_singleton;
    }

    /** */
    public UserEntryMeta() {
        super("UserEntry", hello.model.UserEntry.class);
    }

    @Override
    public hello.model.UserEntry entityToModel(com.google.appengine.api.datastore.Entity entity) {
        hello.model.UserEntry model = new hello.model.UserEntry();
        model.setCounter((java.lang.Long) entity.getProperty("counter"));
        model.setCreated((java.util.Date) entity.getProperty("created"));
        model.setDestination((java.lang.String) entity.getProperty("destination"));
        model.setKey(entity.getKey());
        model.setThumbnailLoaded((java.lang.Boolean) entity.getProperty("thumbnailLoaded"));
        model.setThumbnailUrl((java.lang.String) entity.getProperty("thumbnailUrl"));
        model.setTitle((java.lang.String) entity.getProperty("title"));
        model.setUserId((java.lang.String) entity.getProperty("userId"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        hello.model.UserEntry m = (hello.model.UserEntry) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("counter", m.getCounter());
        entity.setProperty("created", m.getCreated());
        entity.setProperty("destination", m.getDestination());
        entity.setProperty("thumbnailLoaded", m.getThumbnailLoaded());
        entity.setProperty("thumbnailUrl", m.getThumbnailUrl());
        entity.setProperty("title", m.getTitle());
        entity.setProperty("userId", m.getUserId());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        hello.model.UserEntry m = (hello.model.UserEntry) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        hello.model.UserEntry m = (hello.model.UserEntry) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        hello.model.UserEntry m = (hello.model.UserEntry) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        hello.model.UserEntry m = (hello.model.UserEntry) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    protected void postGet(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        hello.model.UserEntry m = (hello.model.UserEntry) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getCounter() != null){
            writer.setNextPropertyName("counter");
            encoder0.encode(writer, m.getCounter());
        }
        if(m.getCreated() != null){
            writer.setNextPropertyName("created");
            encoder0.encode(writer, m.getCreated());
        }
        if(m.getDestination() != null){
            writer.setNextPropertyName("destination");
            encoder0.encode(writer, m.getDestination());
        }
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder0.encode(writer, m.getKey());
        }
        if(m.getThumbnailLoaded() != null){
            writer.setNextPropertyName("thumbnailLoaded");
            encoder0.encode(writer, m.getThumbnailLoaded());
        }
        if(m.getThumbnailUrl() != null){
            writer.setNextPropertyName("thumbnailUrl");
            encoder0.encode(writer, m.getThumbnailUrl());
        }
        if(m.getTitle() != null){
            writer.setNextPropertyName("title");
            encoder0.encode(writer, m.getTitle());
        }
        if(m.getUserId() != null){
            writer.setNextPropertyName("userId");
            encoder0.encode(writer, m.getUserId());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder0.encode(writer, m.getVersion());
        }
        writer.endObject();
    }

    @Override
    protected hello.model.UserEntry jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        hello.model.UserEntry m = new hello.model.UserEntry();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("counter");
        m.setCounter(decoder0.decode(reader, m.getCounter()));
        reader = rootReader.newObjectReader("created");
        m.setCreated(decoder0.decode(reader, m.getCreated()));
        reader = rootReader.newObjectReader("destination");
        m.setDestination(decoder0.decode(reader, m.getDestination()));
        reader = rootReader.newObjectReader("key");
        m.setKey(decoder0.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("thumbnailLoaded");
        m.setThumbnailLoaded(decoder0.decode(reader, m.getThumbnailLoaded()));
        reader = rootReader.newObjectReader("thumbnailUrl");
        m.setThumbnailUrl(decoder0.decode(reader, m.getThumbnailUrl()));
        reader = rootReader.newObjectReader("title");
        m.setTitle(decoder0.decode(reader, m.getTitle()));
        reader = rootReader.newObjectReader("userId");
        m.setUserId(decoder0.decode(reader, m.getUserId()));
        reader = rootReader.newObjectReader("version");
        m.setVersion(decoder0.decode(reader, m.getVersion()));
        return m;
    }
}